<template>
	<view class="u-wrap">
		
		<!-- 轮播图 -->
		<swiper class="swiper-container" circular :indicatorColor="indicatorColor" :indicator-dots="indicatorDots"
			:autoplay="autoplay" :interval="interval" :duration="duration">
			<swiper-item v-for="(item,index) in swipperList">
				<image class="imgs" :src="item.image"></image>
			</swiper-item>
		</swiper>
		<!-- 搜索框 -->
		<u-sticky>
			<view class="sticky">
				<u-search margin="8px;" style="flex-grow:1; " action-style="background-color: #ffff;border: 2px solid #ffff;
  border-radius: 5px ;height:26px" :show-action="true" action-text="搜索" :animation="true"></u-search>
			</view>
		</u-sticky>
		<view class="">
			<u-waterfall v-model="flowList" ref="uWaterfall">
				<template v-slot:left="{leftList}">
					<view class="demo-warter-left" v-for="(item, index) in leftList" :key="index">
						<!-- 警告：微信小程序中需要hx2.8.11版本才支持在template中结合其他组件，比如下方的lazy-load组件 -->
						<u-lazy-load threshold="-450" border-radius="10" :image="item.image"
							:index="index"></u-lazy-load>
						<view class="demo-title">
							{{item.title}}
						</view>
						<view class="demo-price">
							{{item.price}}元
						</view>
						<view class="demo-tag">
							<view class="demo-tag-owner2">
								MOKE自营
							</view>
							<view class="demo-tag-text">
								放心购
							</view>
						</view>
						<view class="demo-shop">
							{{item.shop}}
						</view>

					</view>
				</template>
				<template v-slot:right="{rightList}">
					<view class="demo-warter-right" v-for="(item, index) in rightList" :key="index">
						<u-lazy-load threshold="-450" border-radius="10" :image="item.image"
							:index="index"></u-lazy-load>
						<view class="demo-title">
							{{item.title}}
						</view>
						<view class="demo-price">
							{{item.price}}元
						</view>
						<view class="demo-tag">
							<view class="demo-tag-owner">
								卖家信用极好
							</view>
							<view class="demo-tag-text">
								放心购
							</view>
						</view>
						<view class="demo-shop">
							{{item.shop}}
						</view>

					</view>
				</template>
			</u-waterfall>
			<u-loadmore bg-color="rgb(240, 240, 240)" :status="loadStatus" @loadmore="addRandomData"></u-loadmore>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue';
	const indicatorDots = ref(true)
	const indicatorColor = ref("#FFF")
	const autoplay = ref(true)
	const interval = ref(2000)
	const duration = ref(500)
	// 轮播图数据
	const swipperList = ref([{
		image: "/static/1.png"
	}, {
		image: "/static/2.png"
	}, {
		image: "/static/3.png"
	}])

	// 瀑布流
	const flowList = ref([{
		price: 6399,
		title: '苹果15ProMax',
		shop: '周董数码',
		image: '/static/11.jpg',
	}, {
		price: 3099,
		title: '苹果13ProMax',
		shop: '星源数码',
		image: '/static/22.jpg',
	}, {
		price: 1200,
		title: '苹果11',
		shop: '乐天通讯',
		image: '/static/33.jpg',
	}, {
		price: 3050,
		title: 'IQOO12 Pro',
		shop: '天王星打电动的福寿螺',
		image: '/static/44.jpg',
	}, {
		price: 3499,
		title: '苹果手机',
		shop: '星源数码',
		image: '/static/22.jpg',
	}, {
		price: 3499,
		title: '苹果手机',
		shop: '星源数码',
		image: '/static/22.jpg',
	}, {
		price: 3499,
		title: '苹果手机',
		shop: '星源数码',
		image: '/static/22.jpg',
	}])
</script>

<style lang="scss">
	.swiper-container {
		height: 180px;

		.item {
			height: 180px;
		}

		.imgs {
			height: 180px;
			width: 100%;
		}
	}

	.demo-warter-left {
		border-radius: 8px;
		margin: 5px 0px 5px 5px;
		background-color: #ffffff;
		padding: 8px;
		position: relative;
	}

	.demo-warter-right {
		border-radius: 8px;
		margin: 5px 5px 5px 0px;
		background-color: #ffffff;
		padding: 8px;
		position: relative;
	}

	.u-close {
		position: absolute;
		top: 32rpx;
		right: 32rpx;
	}

	.demo-image {
		width: 100%;
		border-radius: 4px;
	}

	.demo-title {
		font-size: 30rpx;
		margin-top: 5px;
		color: $u-main-color;
	}

	.demo-tag {
		display: flex;
		margin-top: 5px;
	}

	.demo-tag-owner {
		background-color: rgb(255, 255, 164);
		color: #b6a700;
		display: flex;
		align-items: center;
		padding: 4rpx 14rpx;
		border-radius: 50rpx;
		font-size: 20rpx;
		line-height: 1;
	}

	.demo-tag-owner2 {
		background-color: rgb(231, 0, 0);
		color: #ffffff;
		display: flex;
		align-items: center;
		padding: 4rpx 14rpx;
		border-radius: 50rpx;
		font-size: 20rpx;
		line-height: 1;
	}

	.demo-tag-text {
		border: 1px solid $u-type-primary;
		color: $u-type-primary;
		margin-left: 10px;
		border-radius: 50rpx;
		line-height: 1;
		padding: 4rpx 14rpx;
		display: flex;
		align-items: center;
		border-radius: 50rpx;
		font-size: 20rpx;
	}

	.demo-price {
		font-size: 30rpx;
		color: $u-type-error;
		margin-top: 5px;
	}

	.demo-shop {
		font-size: 22rpx;
		color: $u-tips-color;
		margin-top: 5px;
	}

	.search {
		font-size: 7rpx;
		margin: 2px 5px 2px 5px;
	}

	.container {
		height: 200vh;
		margin-top: 150rpx;
	}

	.sticky {
		// width: 750rpx;
		// height: 144rpx;
		// background-color: #ffff;
		// color: #fff;
		// padding: 24rpx;
		// margin-top: -16px;
		position: sticky;
		z-index:99;
		top:0;
		
		left:0;
		display:flex;
		align-items: center;
	}

scroll-view ::v-deep ::-webkit-scrollbar{
		width: 0;
		height: 0;
		color: transparent;
	}
</style>